import os
import sys
import re


# 转换的字符集合，共70个，可自己优化添加，越多越逼真，每个字符对应一种或者几种亮度
ascii_char = list("$@B%8&WM#*oahkbdpqwmZO0QLCJUYXzcvunxrjft/\|()1{}[]?-_+~<>i!lI;:,\"^`'. ")

# 将256灰度映射到70个字符上
def get_char(r,g,b,alpha = 256):
    # alpha 值为 0 的时候表示图片中该位置为空白
    if alpha == 0:
        return ' '
    length = len(ascii_char)
    # 把RGB色域转换成灰度图 ，使用权重
    gray = int(0.2126 * r + 0.7152 * g + 0.0722 * b)
    # ascii_char有70个，把256个灰度值分成70组
    unit = (256.0 + 1)/length
    # 当前像素的灰度属于70个组中的哪个组
    return ascii_char[int(gray/unit)]

if __name__ == '__main__':
    handler = sys.stdin
    point_dict = {}
    for line in handler:
        row = line.strip().split(' ')[0]
        col = line.strip().split(' ')[1]
        r = float(line.strip().split(' ')[2])
        g = float(line.strip().split(' ')[3])
        b = float(line.strip().split(' ')[4])
        if (row, col) not in point_dict.keys():
            point_dict[(row, col)] = (r, g, b)
        else:
            point_dict[(row, col)] = (float(point_dict[(row, col)][0]) + r, float(point_dict[(row, col)][1]) + g, float(point_dict[(row, col)][2]) + b)

    txt = ''
    flag = 80
    result = []
    for j in point_dict:
        # print(j, point_dict[j])
        txt += get_char(*point_dict[j])
        flag -= 1
        if flag%80 == 0:
            txt += '\n'
            flag = 80

    print(txt)

